package java_thinking.unit_21._21_1;


import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;

/**
 * @Desc:   1-2 线程安全的数值序列生成器
 * @author: cww
 * @DateTime: 2019-05-28 23:26
 */
@ThreadSafe
public class Sequence {
    @GuardedBy("this") private int value;

    public synchronized int getValue() {
        return value++;
    }
}
